package com.liujit.bms.app.controller;

import com.liujit.common.domain.result.DictItem;
import com.liujit.common.domain.result.Result;
import com.liujit.upms.api.UpmsFeignClient;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description 博客共通接口
 * @Author liujun
 * @Date 2021-07-13 11:14:42
 */
@RequiredArgsConstructor
@Api(tags = "博客共通接口")
@RestController
@RequestMapping("/blog/common")
public class BlogCommonController {

    private final UpmsFeignClient upmsFeignClient;

    @ApiOperation(value = "字典列表查询", notes = "根据字典编号，分页查询字典列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "code", value = "字典编号", dataType = "String", dataTypeClass = String.class, paramType = "query") })
    @GetMapping("/getList")
    public List<DictItem> getDictItemList(String code) {
        Result<List<DictItem>> result = upmsFeignClient.getDictItem(code);
        return result.getData();
    }
}
